package com.photoeditor.demo.model.image.emoji;

import android.content.Context;

import com.common.base.ComponentContext;
import com.photoeditor.R;
import com.photoeditor.demo.model.bean.stash.ARStickerResource;

/**
 * 这个类是指相机内置的Resource
 */
public class InsideEmojiResource extends StickerApkResource {


    public static final int FROM_EDIT = 1;
    public static final int FROM_STASH = 2;
    private ARStickerResource mARStickerResource;
    /**
     * 默认的 Emoji 列表的id
     */
    private int[] mEmojiIds;
    private int[] mEmojiIds2;
    private int[] mEmojiIds3;

    public InsideEmojiResource(Context context, String pkgName, String name) {
        super(context.getPackageName(), context.getResources());
        init(context, pkgName, name);
    }

    @Override
    public void init(Context context, String pkgName, String name) {
        isExist = true;
        mEmojiNames = InsideStickerTool.STICKER_NAME_ICON_MAP.get(pkgName);
        mEmojiIds = new int[mEmojiNames.length];
        for(int i = 0; i < mEmojiNames.length; i++){
            mEmojiIds[i] =  mRes.getIdentifier(mEmojiNames[i], "drawable", ComponentContext.getContext().getPackageName());
        }
        mStickerIconId = InsideStickerTool.STICKER_BTN_ICON_MAP.get(pkgName);
        setInit(true);
        setName(name);
        mNeedBuy = false;
        mAlreadyBuy = false;
        setBgColor(ComponentContext.getContext().getResources().getColor(R.color.emoji_pannel_default_background_color));
        if(InsideStickerTool.STICKER_PKG_NAME_EMOJI.equals(pkgName)) {
            mARStickerResource = new ARStickerResource(context, R.drawable.ic_emoji);
            mEmojiColNum = StickerConstant.DEFAULT_COL_NUM;
            mEmojiPageNum = StickerConstant.DEFAULT_PAGE_EMOJI_NUM;
            mVerticalSpacing = mRes.getDimensionPixelSize(R.dimen.image_edit_emoji_item_margin);
            mEmojiWidth = mRes.getDimensionPixelSize(R.dimen.image_edit_emoji_item_size);
            mEmojiHeight = mEmojiWidth;
            mItemWidth = mRes.getDimensionPixelSize(R.dimen.default_button_size);
            mItemHeight = mItemWidth;
            mPageHeight = mRes.getDimensionPixelSize(R.dimen.image_edit_grid_height);
            mEditEmojiWidth = mRes.getDimensionPixelSize(R.dimen.image_edit_emoji_default_size);
            mEditEmojiHeight = mRes.getDimensionPixelSize(R.dimen.image_edit_emoji_default_size);
        } else {
            mEmojiColNum = StickerConstant.DEFAULT_COL_NUM_OTHER;
            mEmojiPageNum = StickerConstant.DEFAULT_PAGE_EMOJI_NUM_OTHER;
            mVerticalSpacing = mRes.getDimensionPixelSize(R.dimen.sticker_ar_item_margin);
            mEmojiWidth = mRes.getDimensionPixelSize(R.dimen.sticker_ar_default_size);
            mEmojiHeight = mEmojiWidth;
            mItemWidth = mRes.getDimensionPixelSize(R.dimen.sticker_ar_default_button_size);
            mItemHeight = mItemWidth;
            mPageHeight = mRes.getDimensionPixelSize(R.dimen.sticker_ar_grid_height);
            mEditEmojiWidth = mRes.getDimensionPixelSize(R.dimen.sticker_ar_edit_default_size);
            mEditEmojiHeight = mRes.getDimensionPixelSize(R.dimen.sticker_ar_edit_default_size);
        }
    }

    public ARStickerResource getARStickerResource() {
        return mARStickerResource;
    }

    public int[] getEmojiIds() {
        return mEmojiIds;
    }

    public void setEmojiIds(int[] mEmojiIds) {
        this.mEmojiIds = mEmojiIds;
    }
}
